import axios from 'axios';
import { message } from "antd";

class Config  {
    base: string;
    constructor() {
        this.base = location.protocol + "//" + location.host;
    }

    loadConfig() {
        let _this=this;
        return axios.get("/config/config.json").then(axios => {
            _this.base = axios.data.baseServerURL?axios.data.baseServerURL:_this.base;
            window.config=_this;
        }).catch(error => {
            message.error("加载配置【config.json】失败" + error);
        });
    }

}

export default new Config;